var general = {
    // 设置cookie
    setCookie: function(name, value, day) {
        if(day !== 0){
            var expires = day * 24 * 60 * 60 * 1000;
            var date = new Date(+new Date()+expires);
            document.cookie = name + "=" + escape(value) + ";expires=" + date.toUTCString();
        }else{
            document.cookie = name + "=" + escape(value);
        }
    },
    // 获取cookie
    getCookie: function(name) {
        var arr;
        var reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
        if (arr = document.cookie.match(reg)) {
            return unescape(arr[2]);
        } else {
            return null;
        }
    },
    // 设置localStorage
    setLocanStorage(name, value) {
        localStorage.setItem(name, JSON.stringify(value));
    },
    // 获取localStorage
    getLocanStorage(name) {
        return localStorage.getItem(name);
    },
    // 删除localStorage
    removeLoanStorage(name) {
        localStorage.removeItem(name);
    }
}